home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
lang
/
lsc30p4u.sit
/
Math Library Changes
< prev
next >
Wrap
Text File
|
1989-01-27
|
4KB
|
108 lines
Math Library Changes
1/16/89
The math libraries have been redesigned to be easier to use. A number of
users reported that the organization was confusing.
In particular, it was difficult to keep straight when one should #define
the _MC68881_ and _ERRORCHECK_ macros. This has now been simplified.
SUMMARY OF CHANGES
------------------
You no longer need to #define the _MC68881_ or _ERRORCHECK_ symbols.
You no longer need to rebuild the math libraries to match your use of
_ERRORCHECK_. The libraries can now be used in either error-checking or
non-error-checking modes. Error checking is controlled by a new macro,
_NOERRORCHECK_.
Isn't _NOERRORCHECK_ just _ERRORCHECK_ in disguise? Sort of, but there
are two important differences:
(1) Previously, if you failed to #define _ERRORCHECK_ when you
should, or #defined it when you shouldn't, you would get link
errors. This won't happen with _NOERRORCHECK_.
(2) The change reflects the fact that error checking is always
the default: unless you specifically go to the trouble to
#define _NOERRORCHECK_, you'll get error checking.
If you have existing code that #defines _MC68881_ or _ERRORCHECK_, you
needn't worry. The "math.h" header overrides your definitions, based
on the project option setting (for _MC68881_) and the _NOERRORCHECK_
macro (for _ERRORCHECK_).
WHICH LIBRARY IS WHICH
----------------------
There are three math libraries, "Math", "Math881", and "MathHybrid":
(1) "Math" uses SANE arithmetic on SANE values.
(2) "Math881" uses 68881 arithmetic on 68881 values.
(3) "MathHybrid" uses SANE arithmetic on 68881 values.
If you are not using the 68881, use "Math". If you are using the 68881,
use "Math881" for speed, or "MathHybrid" for precision.
Make sure the 68881 project option is set correctly for the library you
are using. If you are using "Math", the option should be OFF (unchecked).
If you are using "Math881" or "MathHybrid", the option should be ON
(checked).
You no longer need to #define the _MC68881_ macro when using the 68881.
This is now handled automatically by "math.h" based on the project setting.
ERROR CHECKING
--------------
The functions defined in "Math" perform standard error checking. To
suppress error checking, you must rebuild "Math". The remainder of this
section applies ONLY to the "Math881" and "MathHybrid" libraries.
The functions defined in "Math881" and "MathHybrid" come in error-checking
and non-error-checking versions. The non-error-checking functions have
names, like "_sin", that begin with an underscore. The error-checking
functions have names, like "sin", that do not begin with an underscore.
This allows you to choose which math operations employ error checking.
Especially when using "Math881", suppressing error checking may result in
a noticeable improvement in performance.
To suppress error checking on all math operations throughout a particular
file, begin the file with:
#define _NOERRORCHECK_
#include <math.h>
This defines a series of macros, such as "#define sin(x) _sin(x)", which
map the error-checking names onto the non-error-checking functions.
You no longer need to #define the _ERRORCHECK_ macro when using error
checking. This is now handled automatically by "math.h" based on the
_NOERRORCHECK_ macro.
REBUILDING THE MATH LIBRARIES
-----------------------------
There is no longer any need to rebuild the math libraries just to control
error checking. However, if you are not using error checking at all, you
may wish to build smaller libraries that contain no error-checking code.
Each of the files "Math.c", "Math881.c", and "MathHybrid.c" begins with:
/*#define _NOERRORCHECK_*/
#include "math.h"
Simply un-comment the macro definition and rebuild the corresponding
project.
Note that the math library sources no longer #include "config.h".